package org.tsinghua.air.common;

public class Constant {
	public static enum Database {
		COUNTRY("Country", "COUNTRY"),
		DEVELOPMENT_STAGE("Development Stage", "DEVELOPMENT_STAGE"),
		INDUSTRIALIZATION_INDEX("Industrialization Index", "INDUSTRIALIZATION_INDEX"),
		LAW_POLICY("Law & Policy", "LAW_POLICY"),
		RULE_OF_LAW_INDEX("Rule of Law Index", "RULE_OF_LAW_INDEX"),
		PER_EMISSION("PerEmission", "PER_EMISSION"),
		PER_GDP("PerGDP", "PER_GDP"),
		URBAN("Urban", "URBAN");

		String name;
		String table;

		private Database(String name, String table) {
			this.name = name;
			this.table = table;
		}

		public String getTable() {
			return table;
		}

		public String toString() {
			return name;
		}

		public static String nameToTable(String name) {
			for (Database d : Database.values()) {
				if (d.toString().equalsIgnoreCase(name))
					return d.getTable();
			}
			return null;
		}
	}

	public static enum Xls {
		Urban("Urban", Database.URBAN), 
		PerGDP("PerGDP", Database.PER_GDP), 
		PerEmission("PerEmission", Database.PER_EMISSION),
		LawRule("LawRule",Database.RULE_OF_LAW_INDEX), 
		Industry("Industry", Database.INDUSTRIALIZATION_INDEX);

		String name;
		Database table;

		private Xls(String name, Database table) {
			this.name = name;
			this.table = table;
		}

		public Database getTable() {
			return table;
		}

		public String toString() {
			return name;
		}

		public static Database nameToTable(String name) {
			for (Xls d : Xls.values()) {
				if (d.toString().equalsIgnoreCase(name))
					return d.getTable();
			}
			return null;
		}
	}
}
